<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('物资管理')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-feed-depot" th:object="${feed}">
		<input name="workNoticeId" id="workNoticeId"  th:field="*{workNoticeId}" type="hidden"  />
		<div class="form-group">
			<label class="col-sm-3 control-label">主饲料名称：</label>
			<div class="col-sm-8">
				<select id="z-feedName" class="form-control select2-multiple"  feed_type="1" name="feedName" >
					<option th:each="user:${meterial}" th:value="${user.feedId}" th:text="${user.feedName}+'--库存' +':('+${user.stockAmout}+')kg'"></option>
				</select>

			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label ">数量：</label>
			<div class="col-sm-8">
				<input id="z-num" class="form-control" required="required" type="number" name="outputAmount"  min="0" onkeyup=" value=value.replace(/^((\d+\.\d*[1-9]\d{1}))$/,'')" tep="0.1" value="0"/>
			</div>
		</div>
		<!--<input name="feedId" type="hidden" />-->
		<div class="form-group">
			<label class="col-sm-3 control-label">辅饲料名称：</label>
			<div class="col-sm-8">
				<!--<input name="feedName"  feed_type="1" onclick="selectMeterialTree()" id="treeName" type="text" readonly="true" placeholder="请选择" class="form-control" required>-->

				<select id="f-feedName" class="form-control select2-multiple"  feed_type="2" name="feedName" >
					<option th:each="user:${meterial1}" th:value="${user.feedId}" th:text="${user.feedName}+'--库存' +':('+${user.stockAmout}+')kg'" ></option>
				</select>

			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label ">数量：</label>
			<div class="col-sm-8">
				<input id="f-num" class="form-control" required="required" type="number" name="outputAmount"  feed_type="2" min="0" onkeyup=" value=value.replace(/^((\d+\.\d*[1-9]\d{1}))$/,'')" step="0.1" value="0" />
			</div>
		</div>

	</form>
</div>
<th:block th:include="include :: footer" />
<script>
	function submitHandler() {
		/*if ($.validate.form()) {
			$.operate.save(ctx + "system/ncWorkNotice/feed", $('#form-feed-depot').serialize());
		}*/

		postfeed();
	}

	/*表单确认*/
	function postfeed() {
		var data = [];
		var z_feedName = $("#z-feedName").val();
		var z_num = $("#z-num").val();

		var f_feedName = $("#f-feedName").val();
		var f_num = $("#f-num").val();

		var datas ={z_feedName:z_feedName,z_num:z_num,f_feedName:f_feedName,f_num:f_num}


		console.log(datas)
        var workNoticeId = $("#workNoticeId").val()
		var url = ctx + 'system/ncChickenWorkNotice/feed'
		myPost(url, {feedes:datas,workNoticeId:workNoticeId},
				function (data) {
					if (data.code == 0) {
						layer.msg("成功")
						 reload()
					} else {
						layer.msg(data.msg);
					}

				}, function (e) {
					layer.msg("确认失败!");
				})

	}

	function reload() {
		parent.window.close();
		parent.window.location.reload();

	}

</script>
</body>

</html>
